package com.woniu.ly.manageassembly.service.Impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.ly.manageassembly.dao.*;
import com.woniu.ly.manageassembly.model.info.Operation;
import com.woniu.ly.manageassembly.model.info.Singleton;
import com.woniu.ly.manageassembly.service.AdminService;
import com.woniu.ly.model.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private GuideMapper guideMapper;

    @Override
    public int addGuide(Guide guide) {
        guideMapper.insert(guide);
        return guide.getGuideId();
    }

    @Autowired
    private SingletonMapper singletonMapper;
    @Override
    public void addScatteredPassengers(Singleton singleton) {
        singletonMapper.insert(singleton);
    }

    @Autowired
    private CardMapper cardMapper;
    @Override
    public int addCard(Card card) {
        cardMapper.insert(card);
        return card.getCardId();
    }

    @Autowired
    private TravelerMapper travelerMapper;

    @Override
    public int addTraveler(Traveler traveler) {
        travelerMapper.insert(traveler);
        return traveler.getTourId();
    }

    @Autowired
    private TourMapper tourMapper;

    @Override
    public void changeTourStatus(int tourId, String status) {
        tourMapper.changeTourStatus(tourId, status);
    }

    @Override
    public void chooseGuide(int guideId, int tourId) {
        tourMapper.chooseGuide(guideId, tourId);
    }

    @Override
    public void changeGuideStatus(int guideId, String status) {
        guideMapper.changeGuideStatus(guideId, status);
    }
    @Override
    public IPage<Guide> getGuide(Page<Guide> page, String guideStatus, String guideName) {
        return guideMapper.getGuide(page, guideStatus, guideName);
    }

    @Autowired
    private HotelMapper hotelMapper;
    @Override
    public int addHotel(Hotel hotel) {
        hotelMapper.insert(hotel);
        return hotel.getHotelId();
    }

    @Autowired
    private OperationMapper operationMapper;
    @Override
    public void addOperation(Operation operation) {
        operationMapper.insert(operation);
    }

    @Override
    public void changeHotelStatus(int hotelId, String operationContent) {
        hotelMapper.changeHotelStatus(hotelId,operationContent);
    }

    @Autowired
    private SpotMapper spotMapper;

    @Override
    public IPage<Spot> getSpot(Page<Spot> page, String spotName) {
        return spotMapper.getSpotByName(page,spotName);
    }

    @Override
    public void addSpot(Spot spot) {
        spotMapper.insert(spot);
    }

    @Override
    public Spot getSpotById(int spotId) {
        return spotMapper.selectById(spotId);
    }

    @Override
    public void modifySpotById(Spot spot) {
        spotMapper.updateById(spot);
    }

    @Autowired
    private HotelImgMapper hotelImgMapper;

    @Override
    public void addHotelImg(HotelImg hotelImg) {
        hotelImgMapper.insert(hotelImg);
    }

    @Autowired
    private SpotImgMapper spotImgMapper;

    @Override
    public void addSpotImg(SpotImg spotImg) {
        spotImgMapper.insert(spotImg);
    }

    @Override
    public IPage<Tour> getTours(Page<Tour> page, int tourId, String tourType, int productId, String tourStatus) {
        return tourMapper.getTours(page,tourId,tourType,productId,tourStatus);
    }

    @Override
    public int makeTourGroups(Tour tour) {
        tourMapper.insert(tour);
        return tour.getTourId();
    }

    @Override
    public Tour getTour(int tourId) {
        return tourMapper.selectById(tourId);
    }

    @Autowired
    private UserOrderMapper userOrderMapper;
    @Override
    public List<UserOrder> getUserOrders(int tourId,String tourGenre) {
        return userOrderMapper.getUserOrders(tourId,tourGenre);
    }

    @Autowired
    private UserOrderDetailMapper userOrderDetailMapper;

    @Override
    public List<UserOrderDetail> getUserOrderDetails(int userOrderId) {
        return userOrderDetailMapper.getUserOrderDetails(userOrderId);
    }

    @Autowired
    private UserChargebackDetailMapper userChargebackDetailMapper;
    @Override
    public int addUserChargebackDetail(UserChargebackDetail ucd) {
        userChargebackDetailMapper.insert(ucd);
        return ucd.getUserChargebackdetailId();
    }

    @Autowired
    private UserAccountMapper userAccountMapper;
    @Override
    public int addUserAccount(UserAccount userAccount) {
        userAccountMapper.insert(userAccount);
        return userAccount.getUserAccountId();
    }

    @Autowired
    private PlatfromStatementMapper platfromStatementMapper;

    @Override
    public int addPlatfromStatement(PlatfromStatement platfromStatement) {
        platfromStatementMapper.insert(platfromStatement);
        return platfromStatement.getStatementId();
    }

    @Autowired
    private PlatfromAccountMapper platfromAccountMapper;

    @Override
    public PlatfromAccount getPlatfromAccount() {
        return platfromAccountMapper.getPlatfromAccount();
    }

    @Override
    public void addPlatfromAccount(PlatfromAccount platfromAccount) {
        platfromAccountMapper.insert(platfromAccount);
    }

    @Autowired
    private SeckillTourMapper seckillTourMapper;
    @Override
    public void changeSeckillTourStatus(int seckillTourId, String status) {
        seckillTourMapper.changeSeckillTourStatus(seckillTourId,status);
    }

    @Override
    public void chooseSeckillGuide(int guideId, int seckilltourId) {
        seckillTourMapper.chooseSeckillGuide(guideId, seckilltourId);
    }

    @Override
    public IPage<Tour> getSeckillTours(Page<Tour> page, int seckillTourId, String tourType, int productId, String tourStatus) {
        return seckillTourMapper.getSeckillTours(page,seckillTourId,tourType,productId,tourStatus);
    }

    @Override
    public int makeSeckillTourGroups(SeckillTour tour) {
        seckillTourMapper.insert(tour);
        return tour.getSeckillTourId();
    }

    @Override
    public SeckillTour getSeckillTour(int seckillTourId) {
        return seckillTourMapper.selectById(seckillTourId);
    }

    @Override
    public List<Card> selectCard() {
        return seckillTourMapper.selectCardTime();
    }

    @Override
    public Traveler getTraveler(int travelerId) {
        return travelerMapper.selectById(travelerId);
    }

    @Override
    public IPage<UserOrderDetail> getUserOrderDetailStatus(Page<UserOrderDetail> page, String userOrderDetailStatus) {
        return userOrderDetailMapper.getUserOrderDetailStatus(page,userOrderDetailStatus);
    }

    @Override
    public void changeUserOrderDetailStatus(int userOrderId, int travelerId, String status) {
        userOrderDetailMapper.changeUserOrderDetailStatus(userOrderId,travelerId,status);
    }

    @Override
    public UserOrder getUserOrder(int userOrderId) {
        return userOrderMapper.selectById(userOrderId);
    }

    @Override
    public Guide selectGuideById(int guideId) {
        return guideMapper.selectById(guideId);
    }

    @Override
    public void updateGuideNumb(Guide guide) {
        guideMapper.updateById(guide);
    }


}
